package com.feicheng.lanniao.controller;

import com.feicheng.lanniao.entity.SysImage;
import com.feicheng.lanniao.result.ResultInfo;
import com.feicheng.lanniao.service.SysImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author tianchunlei
 * @Des //此接口主要实现关于图片上传时个数的控制、查询、修改上传图片控制
 * @Date 2021/9/24
 **/
@RestController
@RequestMapping("/lanniao-admin/image")
public class SysImageController {

    @Autowired
    private SysImageService sysImageService;

    /**
     * @return
     * @Author tianchunlei
     * @Description //查询图片上传个数列表
     * @Date 2021/9/24 10:49
     * @Param
     */
    @GetMapping("/list")
    public ResultInfo getImageNumberList() {
        return sysImageService.list();
    }

    /**
     * @return
     * @Author tianchunlei
     * @Description //修改图片上传列表
     * @Date 2021/9/24 10:49
     * @Param
     */
    @PutMapping("/editor")
    public ResultInfo update(Integer id, Integer type, Integer number) {
        SysImage sysImage = new SysImage(id, type, number);
        return sysImageService.update(sysImage);
    }

    /**
     * @Author tianchunlei
     * @Description //查询单条文件上传图片个数的接口
     * @Date 2021/9/24 12:01
     * @Param
     * @return
     */
    @GetMapping("/info/{id}")
    public ResultInfo update(@PathVariable("id") Integer id) {
        return sysImageService.selectById(id);
    }
}
